package custom.reflection;

import custom.MetaObjectTest.po.Order;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * 通过 ObjectFactory 创建对象的案例
 */
public class TestObjectFactory {
	public static void main(String[] args) {
		ObjectFactory factory = new DefaultObjectFactory();


		List argTypes = new ArrayList();
		argTypes.add(String.class);
		argTypes.add(String.class);
		List args1 = new ArrayList<>();
		args1.add("202005290936");
		args1.add("《百年孤独》");
		Order o = (Order) factory.create(Order.class, argTypes, args1);
		System.out.println(o.getGoodsName());
		System.out.println(o.getOrderNo());
	}
}
